package com.xiangxiangjd.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.xiangxiangjd.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xiangxiangjd.service.ClaimGoodsService;
import com.xiangxiangjd.bean.ClaimGoods;
import com.xiangxiangjd.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  申领和物品中间表 前端控制器
 * </p>
 *
 * @author 肖守凯
 * @since 2021-11-08
 */
@Controller
@RequestMapping("/api/claimGoods")
@Api(tags = "申领统计")
public class ClaimGoodsController extends BaseController{


    /** 分页查询ClaimGoods
     * @param page  页码
     * @param limit  查几条
     * @param claimGoods  前端传进的参数
     * @return 返回统一分页信息
     */
    @PostMapping(value = "admin/findClaimGoodsByPage")
    @ResponseBody
    public ResultPage findClaimGoodsByPage(Integer page, Integer limit,ClaimGoods claimGoods){
             return claimGoodsService.findClaimGoodsByPage(page,limit,claimGoods);
    }

    /** 添加ClaimGoods
     * @param claimGoods  前端传进的参数
     * @return 返回统一信息
     */
    @PostMapping(value = "admin/addClaimGoods")
    @ResponseBody
    public ApiResultModel saveClaimGoods(ClaimGoods claimGoods  ){
             return claimGoodsService.addClaimGoods(claimGoods);
    }

    /** 编辑ClaimGoods
     * @param claimGoods  前端传进的参数
     * @return 返回统一信息
     */
    @PostMapping(value = "admin/editClaimGoods")
    @ResponseBody
    public ApiResultModel editClaimGoods(ClaimGoods claimGoods  ){
             return claimGoodsService.editClaimGoods(claimGoods);
    }

    /** 删除ClaimGoods
     * @param ids  前端传进的ID
     * @return 返回统一信息
     */
    @PostMapping(value = "admin/delClaimGoods")
    @ResponseBody
    public ApiResultModel delClaimGoods(@RequestParam("datas") ArrayList ids){


             return claimGoodsService.delClaimGoodss(ids);
    }


}
